/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.isn.atencionemergencia.entity;

import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

import com.isn.examenes.entity.OrdenDeExamenes;
import com.isn.historiaclinica.entity.HistoriaClinica;
import com.isn.hospitalizacion.entity.OrdenHospitalizacion;
import com.isn.logueo.entity.PersonalAsistencial;
import com.isn.logueo.entity.Usuario;

/**
 *
 * @author pool
 */
@Entity
@Table(name = "orden_de__atencion_de__emergencia")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "OrdenDeAtencionDeEmergencia.findAll", query = "SELECT o FROM OrdenDeAtencionDeEmergencia o"),
    @NamedQuery(name = "OrdenDeAtencionDeEmergencia.findByNumOae", query = "SELECT o FROM OrdenDeAtencionDeEmergencia o WHERE o.numOae = :numOae"),
    @NamedQuery(name = "OrdenDeAtencionDeEmergencia.findByFechaOae", query = "SELECT o FROM OrdenDeAtencionDeEmergencia o WHERE o.fechaOae = :fechaOae"),
    @NamedQuery(name = "OrdenDeAtencionDeEmergencia.findByEstadoOae", query = "SELECT o FROM OrdenDeAtencionDeEmergencia o WHERE o.estadoOae = :estadoOae"),
    @NamedQuery(name = "OrdenDeAtencionDeEmergencia.findByTipOpe", query = "SELECT o FROM OrdenDeAtencionDeEmergencia o WHERE o.tipOpe = :tipOpe")})
public class OrdenDeAtencionDeEmergencia implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "Num_Oae", columnDefinition="CHAR(5) unsigned")
    private String numOae;
    @Column(name = "Fecha_Oae")
    @Temporal(TemporalType.TIMESTAMP)
    private Date fechaOae;
    @Column(name = "Estado_Oae")
    private String estadoOae;
    @Basic(optional = false)
    @Column(name = "tip_ope")
    private String tipOpe;
    @JoinColumn(name = "Usuario", referencedColumnName = "Usuario")
    @ManyToOne(optional = false)
    private Usuario usuario;
    @JoinColumn(name = "Cod_Asis", referencedColumnName = "Cod_Asis")
    @ManyToOne(optional = false)
    private PersonalAsistencial codAsis;
    @JoinColumn(name = "Num_Hc", referencedColumnName = "Num_Hc")
    @ManyToOne(optional = false)
    private HistoriaClinica numHc;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "numOae")
    private Collection<AnimalMordedor> animalMordedorCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "numOae")
    private Collection<OrdenHospitalizacion> ordenHospitalizacionCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "numOae")
    private Collection<ResponsableDelPaciente> responsableDelPacienteCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "numOae")
    private Collection<OrdenDeExamenes> ordenDeExamenesCollection;

    public OrdenDeAtencionDeEmergencia() {
    }

    public OrdenDeAtencionDeEmergencia(String numOae) {
        this.numOae = numOae;
    }

    public OrdenDeAtencionDeEmergencia(String numOae, String tipOpe) {
        this.numOae = numOae;
        this.tipOpe = tipOpe;
    }

    public String getNumOae() {
        return numOae;
    }

    public void setNumOae(String numOae) {
        this.numOae = numOae;
    }

    public Date getFechaOae() {
        return fechaOae;
    }

    public void setFechaOae(Date fechaOae) {
        this.fechaOae = fechaOae;
    }

    public String getEstadoOae() {
        return estadoOae;
    }

    public void setEstadoOae(String estadoOae) {
        this.estadoOae = estadoOae;
    }

    public String getTipOpe() {
        return tipOpe;
    }

    public void setTipOpe(String tipOpe) {
        this.tipOpe = tipOpe;
    }

    public Usuario getUsuario() {
        return usuario;
    }

    public void setUsuario(Usuario usuario) {
        this.usuario = usuario;
    }

    public PersonalAsistencial getCodAsis() {
        return codAsis;
    }

    public void setCodAsis(PersonalAsistencial codAsis) {
        this.codAsis = codAsis;
    }

    public HistoriaClinica getNumHc() {
        return numHc;
    }

    public void setNumHc(HistoriaClinica numHc) {
        this.numHc = numHc;
    }

    @XmlTransient
    public Collection<AnimalMordedor> getAnimalMordedorCollection() {
        return animalMordedorCollection;
    }

    public void setAnimalMordedorCollection(Collection<AnimalMordedor> animalMordedorCollection) {
        this.animalMordedorCollection = animalMordedorCollection;
    }

    @XmlTransient
    public Collection<OrdenHospitalizacion> getOrdenHospitalizacionCollection() {
        return ordenHospitalizacionCollection;
    }

    public void setOrdenHospitalizacionCollection(Collection<OrdenHospitalizacion> ordenHospitalizacionCollection) {
        this.ordenHospitalizacionCollection = ordenHospitalizacionCollection;
    }

    @XmlTransient
    public Collection<ResponsableDelPaciente> getResponsableDelPacienteCollection() {
        return responsableDelPacienteCollection;
    }

    public void setResponsableDelPacienteCollection(Collection<ResponsableDelPaciente> responsableDelPacienteCollection) {
        this.responsableDelPacienteCollection = responsableDelPacienteCollection;
    }

    @XmlTransient
    public Collection<OrdenDeExamenes> getOrdenDeExamenesCollection() {
        return ordenDeExamenesCollection;
    }

    public void setOrdenDeExamenesCollection(Collection<OrdenDeExamenes> ordenDeExamenesCollection) {
        this.ordenDeExamenesCollection = ordenDeExamenesCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (numOae != null ? numOae.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof OrdenDeAtencionDeEmergencia)) {
            return false;
        }
        OrdenDeAtencionDeEmergencia other = (OrdenDeAtencionDeEmergencia) object;
        if ((this.numOae == null && other.numOae != null) || (this.numOae != null && !this.numOae.equals(other.numOae))) {
            return false;
        }
        return true;
    }
    
}
